
<?php 
if (!empty($dataItemInfo)){
	$arrName = array();
	foreach ($dataItemInfo as $dataItemInfo){
		$arrName[$dataItemInfo['Area']['id']] = $dataItemInfo['Area']['name'];
	}
//	debug($arrName);
}?>
<div style = "width: 630px">	
	<div class="modal-header " align ="center" style = "color: green">
	    <h3>Text - Label</h3>
 	 </div>
 	 <br>
	<?php echo $this->Form->create('Text', array('class' => "form-horizontal", 'id' => 'myform', 'url' => array('controller' => 'management', 'action' => 'add_items')));?>
	  <div align ="center">
	  	<table>
	  		<tr>
	  			<td>Area Name</td>
	  			<td colspan = 3><?php echo $this->Form->select('area_id', array(isset($arrName)?$arrName:null), array('class' => 'selectAreaName')); ?> </td>
	  		</tr>
	  		<?php echo $this->Form->input('screen_id', array('label' => false, 'type' => 'hidden', 'value' => isset($idScreen)?$idScreen:null));?>
	  		<tr>
	  			<td>Item Name(Vi)</td>
	  			<td colspan = 3><?php echo $this->Form->input('item_name', array('label' => false));?></td>
	  		</tr>
	  		<tr>
	  			<td ><label  style = "color: red; font-size: 20px">Label</label></td>
	  			<td colspan = 3 ></td>
	  		</tr>
	  		<tr>
	  			<td>Value</td>
	  			<td colspan = 2><?php echo $this->Form->input('value_label', array('label' => false));?></td>
	  			<td><?php echo $this->Form->checkbox('unclearValue', array('label' => false , 'div' =>false ))."Unclear";?></td>
	  		</tr>
	  		<tr>
	  			<td>Font</td>
	  			<td colspan = 2><?php echo $this->Form->input('font_label', array('label' => false));?></td>
	  			<td><?php echo $this->Form->checkbox('unclearFont', array('label' => false))."Unclear";?></td>
	  		</tr>
	  		<tr>
	  			<td>Color</td>
	  			<td colspan = 2><?php echo $this->Form->input('color_label', array('label' => false));?></td>
	  			<td><?php echo $this->Form->checkbox('unclearColor', array('label' => false ))."Unclear";?></td>
	  		</tr>
	  		<tr>
	  			<td>Length</td>
	  			<td colspan = 2><?php echo $this->Form->input('length_label', array('label' => false, 'style' => 'width: 50px' ));?></td>
	  			<td><?php echo $this->Form->checkbox('unclearLength', array('label' => false ))."Unclear";?></td>
	  		</tr>
	  		<tr>
	  			<td ><label  style = "color: red; font-size: 20px">Text</label></td>
	  			<td colspan = 3></td>
	  		</tr>
	  		<tr>
	  			<td>Defaut value</td>
	  			<td colspan = 2><?php echo $this->Form->input('value_text_default', array('label' => false ));?></td>
	  			<td><?php echo $this->Form->checkbox('unclearValueText', array('label' => false ))."Unclear";?></td>
	  		</tr>
	  		<tr>
	  			
	  			<td>Hint value</td>
	  			<td colspan = 2><?php echo $this->Form->input('value_text_hint', array('label' => false));?></td>
	  			<td><?php echo $this->Form->checkbox('unclearLengthText', array('label' => false ))."Unclear";?></td>
	  		</tr>
	  		<tr>
	  			
	  			<td>Data type</td>
	  			<td colspan = 2><?php echo $this->Form->select('data_type', array(), array('class' => 'selectPermission')); ?> </td>
	  			<td><?php echo $this->Form->checkbox('unclearPermission', array('label' => false ))."Unclear";?></td>
	  		</tr>
	  		<tr>
	  			
	  			<td>Required</td>
	  			<td><?php echo $this->Form->checkbox('requied', array('label' => false));?></td>
	  			<td><?php echo "Err Msg: ".$this->Form->input('lengthRequired', array('label' => false , 'div' =>false , 'style' => 'width: 100px'));?></td>
	  			<td><?php echo $this->Form->checkbox('unclearLengthRequired', array('label' => false , 'div' =>false ))."Unclear";?></td>
	  		</tr>
	  		<tr>
	  			<td>Length</td>
	  			<td>
	  			<?php echo $this->Form->input('lengthMin', array('label' => false , 'div' =>false , 'style' => 'width: 50px'));?>
	  			<?php echo "-->"?>
	  			<?php echo $this->Form->input('lengthMax', array('label' => false , 'div' =>false , 'style' => 'width: 50px'));?>
	  			</td>
	  			<td><?php echo "Err Msg < Min".$this->Form->input('leghthErro1', array('label' => false , 'div' =>false , 'style' => 'width: 100px' ));?></td>
	  			<td><?php echo $this->Form->checkbox('unclearErro1', array('label' => false , 'div' =>false ))."Unclear";?></td>
	  		</tr>
	  		<tr>
	  			<td></td>
	  			<td></td>
	  			<td><?php echo "Err Msg > Max".$this->Form->input('leghthErro1', array('label' => false , 'div' =>false , 'style' => 'width: 100px' ));?></td>
	  			<td><?php echo $this->Form->checkbox('unclearErro1', array('label' => false , 'div' =>false ))."Unclear";?></td>
	  		</tr>
	  	</table>
	  </div>
	  <div class="modal-footer" >
	     <div align = "center">
	     <button type="submit" class="btn btn-primary">Save</button>
	     </div> 
	  </div>
	<?php echo $this->Form->end();?>
</div>

<script type="text/javascript">
$( "#myform" ).validate({
	  rules: {
		"data[Text][area_id]": {
			 required: true,
			 min:1
		},
		"data[Text][item_name]": {
		 	required: true
		 },
		"data[Text][value_label]": {
			required: true
		},
		"data[Text][font_label]": {
			required: true
		},
		"data[Text][color_label]": {
			required: true
		},
		"data[Text][length_label]": {
			required: true,
            maxlength: 4,
            number: true,
            min: 1 
		},	  
		"data[Text][value_text_default]": {
			required: true
		},
		"data[Text][value_text_hint]": {
			required: true
		},
//		"data[Text][data_type]": {
//			required: true
//		},
		}
	});
$(".selectAreaName").select2({
    placeholder: "Selection...",
    
});
$(".selectPermission").select2({
    placeholder: "Selection...",
    
});
</script>



















